
#include "my_time.h"
#include <omp.h>

int main() {
  MyTimeI;

  int nthreads = -1;
  int tid = -1;
  int mysum = 0;
  int n = 1000000000;

  MyTimeA;
#pragma omp parallel reduction(+ : mysum) private(tid)
  {
    nthreads = omp_get_num_threads();
    tid = omp_get_thread_num();
    for (int i = tid + 1; i <= n; i = i + nthreads) {
      mysum = mysum + i;
    }
  }
  MyTimeB;

  printf("Number of threads: %d\n", nthreads);
  printf("my sum ret: %d\n", mysum);
}